package com.bite.bite_forum.controller;
import com.bite.bite_forum.exception.ApplicationException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.*;

@Api(tags = "测试类接口")
@RestController
@RequestMapping("/text")
public class TextController {

    @ApiOperation("接口测试1， ")
    @GetMapping ("/t1")
    public String text(){
        return "text";
    }


    @ApiOperation("接口测试2, 显示异常")
    @GetMapping ("/t2")
    public String textException() throws Exception {
        throw new Exception("Exception异常");

    }

    @ApiOperation("接口测试3 ，测试异常")
    @GetMapping("/t3")
    public String textApplication(){
        throw new ApplicationException("application=====");
    }

    @PostMapping ("/t4")
    @ApiOperation("接口测试4 测试传入的参数")
    public String text4(@ApiParam("名字") @RequestParam("name") String name){
        return "name ==" + name;
    }
}
